<script lang="ts" setup>
  import { h } from 'vue';
  import Button from '@sscd/button';
  import Space from '@sscd/space';
  import Modal from '@sscd/modal';
  const info = () => {
    Modal.info({
      title: 'This is a notification message',
      content: h('div', {}, [
        h('p', 'some messages...some messages...'),
        h('p', 'some messages...some messages...'),
      ]),
      onOk() {
        // vue3.4+版本可能会出现Modal无法正常关闭，需调用Modal.remove()
        console.log('ok');
        Modal.remove()
      },
    });
  };
  const success = () => {
    Modal.success({
      title: 'This is a success message',
      content: h('div', {}, [
        h('p', 'some messages...some messages...'),
        h('p', 'some messages...some messages...'),
      ]),
      onOk() {
        // vue3.4+版本可能会出现Modal无法正常关闭，需调用Modal.remove()
        console.log('ok')
        Modal.remove()
      },
    });
  };
  const error = () => {
    Modal.error({
      title: 'This is an error message',
      content: 'some messages...some messages...',
      onOk() {
        // vue3.4+版本可能会出现Modal无法正常关闭，需调用Modal.remove()
        console.log('ok')
        Modal.remove()
      },
    });
  };
  const warning = () => {
    Modal.warning({
      title: 'This is a warning message',
      content: 'some messages...some messages...',
      onOk() {
        // vue3.4+版本可能会出现Modal无法正常关闭，需调用Modal.remove()
        console.log('ok')
        Modal.remove()
      },
    });
  };
</script>

<template>
  <div class="demo">
    <div class="demo-title">信息提示</div>
    <div class="demo-content">
      <Space wrap>
        <Button @click="info">Info</Button>
        <Button @click="success">Success</Button>
        <Button @click="error">Error</Button>
        <Button @click="warning">Warning</Button>
      </Space>
    </div>
  </div>
</template>
